import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '赛事id',
    align:"center",
    dataIndex: 'saisId_dictText'
   },
   {
    title: '区域',
    align:"center",
    dataIndex: 'quy',
    customRender:({text}) => {
       return  render.renderCategoryTree(text,'C05')
   },
   },
   {
    title: '赛事进程id',
    align:"center",
    dataIndex: 'saisjcId_dictText'
   },
   {
    title: '事件',
    align:"center",
    dataIndex: 'shij_dictText'
   },
   {
    title: '开始时间',
    align:"center",
    dataIndex: 'kaissj',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '结束时间',
    align:"center",
    dataIndex: 'jiessj',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "赛事id",
      field: 'saisId',
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"cdba2_sais,mingc,id"
      },
      //colProps: {span: 6},
 	},
	{
      label: "区域",
      field: 'quy',
      component: 'JCategorySelect',
      componentProps:{
          pcode:"C05",//back和事件未添加，暂时有问题
      },
      //colProps: {span: 6},
 	},
	{
      label: "赛事进程id",
      field: 'saisjcId',
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"cdba2_saisjc,jincmc,id"
      },
      //colProps: {span: 6},
 	},
	{
      label: "事件",
      field: 'shij',
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"saissj"
      },
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '赛事id',
    field: 'saisId',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"cdba2_sais,mingc,id"
     },
  },
  {
    label: '区域',
    field: 'quy',
    component: 'JCategorySelect',
    componentProps:{
       pcode:"C05", //TODO back和事件未添加，暂时有问题
    },
  },
  {
    label: '赛事进程id',
    field: 'saisjcId',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"cdba2_saisjc,jincmc,id"
     },
  },
  {
    label: '事件',
    field: 'shij',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"saissj"
     },
  },
  {
    label: '开始时间',
    field: 'kaissj',
    component: 'DatePicker',
  },
  {
    label: '结束时间',
    field: 'jiessj',
    component: 'DatePicker',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  saisId: {title: '赛事id',order: 0,view: 'list', type: 'string',dictTable: "cdba2_sais", dictCode: 'id', dictText: 'mingc',},
  quy: {title: '区域',order: 1,view: 'cat_tree', type: 'string',pcode: 'C05',},
  saisjcId: {title: '赛事进程id',order: 2,view: 'list', type: 'string',dictTable: "cdba2_saisjc", dictCode: 'id', dictText: 'jincmc',},
  shij: {title: '事件',order: 3,view: 'list', type: 'string',dictCode: 'saissj',},
  kaissj: {title: '开始时间',order: 4,view: 'date', type: 'string',},
  jiessj: {title: '结束时间',order: 5,view: 'date', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}